<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>查看评论页面</title>
</head>
<body>
<div style="width: 80%;height: 80%;text-align: center;border: black solid 2px;margin-left: 10%;margin-top: 50px;background-color:#d3d7df">
    <div style="margin-top: 10px">
        <div>
            <button>
                <a th:href="@{/comment/addComment}">添加评论</a>
            </button>
            <button>
                <a th:href="@{/admin/index}">返回首页</a>
            </button>
<!--            <div th:each="comment:${list}" >-->
<!--                <span th:text="${comment.commentContent}"></span>-->
<!--                <div th:each="comment:${list}">-->
<!--                    <table>-->
<!--                        <span th:if="${comment.commentedId eq comment.commentId}" th:text="${comment.commentContent}">@回复</span><br>-->
<!--                    </table>-->
<!--                </div>-->
<!--                &lt;!&ndash;          管理员功能：删除   &ndash;&gt;-->
<!--                <div style="margin-right: 20%">-->
<!--                    <a th:href="@{/comment/deleteByCommentId(id=${comment.commentId},gid=${comment.goodsId})}">删除</a>-->
<!--                </div>-->
<!--                &lt;!&ndash;          商家功能： 回复    &ndash;&gt;-->
<!--                <div style="margin-right: 20%">-->
<!--                    <form th:action="@{/comment/reply}" method="post" >-->
<!--                        <input type="hidden" name="commentId" th:value="${comment.commentId}">-->
<!--                        <input type="hidden" name="goodsId" th:value="${comment.goodsId}">-->
<!--                        <input type="text" name="commentContent" >-->

<!--                        &lt;!&ndash;            <img th:url="${comment.commentPicture}"><br>&ndash;&gt;-->
<!--                        <input type="submit" value="回复">-->
<!--                    </form>-->
<!--                </div>-->
<!--            </div>-->
        </div>
        <div>
            <table style="text-align: center;width: 80%;margin-left: 10%">
                <tr>
                    <td>评论id</td>
                    <td>用户id</td>
                    <td>评论商品id</td>
                    <td>评论内容</td>
                    <td>被评论Id</td>
                    <td>评论照片地址</td>
                    <td>评论时间</td>
                    <td>编辑</td>
                </tr>
                <tr th:each="comment:${list}">
                    <td th:text="${comment.commentId}"></td>
                    <td th:text="${comment.userId}"></td>
                    <td th:text="${comment.goodsId}"></td>
                    <td th:text="${comment.commentContent}"></td>
                    <td th:text="${comment.commentedId}"></td>
                    <td>
                        <img width="50px" height="50px" th:src="${comment.commentPicture}">
                    </td>
                    <td th:date="${comment.commentDate}"></td>
                    <td>
                        <a th:href="@{/comment/deleteByCommentId(id=${comment.commentId},gid=${comment.goodsId})}">删除</a>
                    </td>
                    <td>
                        <form th:action="@{/comment/reply}" method="post" enctype="multipart/form-data">
                            <input type="hidden" name="commentId" th:value="${comment.commentId}"><br>
                            <input type="hidden" name="goodsId" th:value="${comment.goodsId}"><br>
                            <input type="text" name="commentContent" ><br>
                            <input type="submit" value="回复">
                        </form>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>
</body>
</html>